package gui;

import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JPanel;
import java.awt.Color;
import javax.swing.JLabel;
import java.awt.Font;
import java.awt.event.ActionListener;
import java.util.Calendar;
import java.util.Random;

import javax.swing.JButton;
import javax.swing.SwingConstants;
		
//		Receipt screen
public class Receipt extends JPanel {

	private JLabel lblGz1;
	private JLabel lblGz2;
	private JLabel lblTxt1;
	private JLabel lblAmount;
	private JButton btnBack;
	private JLabel lblUnderline;
	private JLabel lblTxt2;
	private JLabel labelOfficialLogo;
	private JLabel labelMinilogo;
	private JLabel lblCopyright;
	private JLabel lblTimeDateRep;
	private JLabel lblDateTime;
	private JButton btnSendToMail;

	public JButton getBtnSendToMail() {
		return btnSendToMail;
	}

	public void setBtnSendToMail(JButton btnSendToMail) {
		this.btnSendToMail = btnSendToMail;
	}

	public Receipt() {
		setBounds(0, 0, 624, 921);
		setBackground(new Color(135, 206, 235));
		setLayout(null);

		Calendar cal = Calendar.getInstance();
		cal.getTime();

		int day = cal.get(Calendar.DAY_OF_MONTH);
		int month = cal.get(Calendar.MONTH) + 1;
		int year = cal.get(Calendar.YEAR);
		int hour = cal.get(Calendar.HOUR_OF_DAY);
		int minute = cal.get(Calendar.MINUTE);
		int sec = cal.get(Calendar.SECOND);

		Random random = new Random();
		int max = 99999999;
		int min = 11111111;

		lblGz1 = new JLabel("TRANSFER");
		lblGz1.setHorizontalAlignment(SwingConstants.CENTER);
		lblGz1.setForeground(new Color(0, 128, 0));
		lblGz1.setFont(new Font("Calibri Light", Font.PLAIN, 85));
		lblGz1.setBounds(106, 132, 404, 100);
		add(lblGz1);

		lblGz2 = new JLabel("SUCCESSFUL");
		lblGz2.setHorizontalAlignment(SwingConstants.CENTER);
		lblGz2.setForeground(new Color(0, 128, 0));
		lblGz2.setFont(new Font("Calibri Light", Font.PLAIN, 85));
		lblGz2.setBounds(74, 215, 473, 100);
		add(lblGz2);

		lblTxt1 = new JLabel("You have successfully transferred the");
		lblTxt1.setFont(new Font("Calibri Light", Font.PLAIN, 32));
		lblTxt1.setBounds(74, 408, 819, 40);
		add(lblTxt1);

		lblAmount = new JLabel("<amount>");
		lblAmount.setHorizontalAlignment(SwingConstants.CENTER);
		lblAmount.setFont(new Font("Calibri Light", Font.PLAIN, 55));
		lblAmount.setBounds(10, 648, 604, 68);
		add(lblAmount);

		btnBack = new JButton("Back to Menu");
		btnBack.setFont(new Font("Calibri Light", Font.PLAIN, 30));
		btnBack.setBounds(10, 765, 231, 121);
		add(btnBack);

		lblUnderline = new JLabel("__________");
		lblUnderline.setHorizontalAlignment(SwingConstants.CENTER);
		lblUnderline.setForeground(new Color(0, 128, 0));
		lblUnderline.setFont(new Font("Calibri Light", Font.PLAIN, 85));
		lblUnderline.setBounds(41, 225, 544, 100);
		add(lblUnderline);

		lblTxt2 = new JLabel("following amount of Bitcoin:");
		lblTxt2.setFont(new Font("Calibri Light", Font.PLAIN, 32));
		lblTxt2.setBounds(74, 444, 370, 40);
		add(lblTxt2);

		Icon officiallogo = new ImageIcon(getClass().getResource(
				"bitcoinofficiallogo.png"));
		labelOfficialLogo = new JLabel("");
		labelOfficialLogo.setBounds(10, 35, 120, 25);
		labelOfficialLogo.setIcon(officiallogo);
		add(labelOfficialLogo);

		Icon minilogo = new ImageIcon(getClass().getResource(
				"LOGOHIGHsmall.png"));
		labelMinilogo = new JLabel(" ");
		labelMinilogo.setBounds(527, 11, 87, 91);
		labelMinilogo.setIcon(minilogo);
		add(labelMinilogo);

		lblCopyright = new JLabel(
				"BCBS Systems, the \"Bitcoin\" logo, and all related systems are copyright Copenhagen Business School and its affiliates ");
		lblCopyright.setForeground(Color.DARK_GRAY);
		lblCopyright.setFont(new Font("Calibri", Font.PLAIN, 8));
		lblCopyright.setBounds(116, 901, 394, 14);
		add(lblCopyright);

		int ReceiptNum = random.nextInt((max - min) + 1) + min;
		lblTimeDateRep = new JLabel(day + "-" + month + "-" + year
				+ "                           " + hour + ";" + minute + ";"
				+ sec + "                         " + ReceiptNum);
		lblTimeDateRep.setFont(new Font("Calibri", Font.ITALIC, 20));
		lblTimeDateRep.setBounds(41, 563, 544, 40);
		add(lblTimeDateRep);

		lblDateTime = new JLabel(
				" DATE                             TIME                 RECEIPT NUMBER");
		lblDateTime.setHorizontalAlignment(SwingConstants.CENTER);
		lblDateTime.setFont(new Font("Calibri Light", Font.BOLD | Font.ITALIC,
				20));
		lblDateTime.setBounds(41, 534, 559, 16);
		add(lblDateTime);

		btnSendToMail = new JButton("Send to Mail");
		btnSendToMail.setFont(new Font("Calibri Light", Font.PLAIN, 30));
		btnSendToMail.setBounds(383, 765, 231, 121);
		add(btnSendToMail);

	}

	public JLabel getLblDateTime() {
		return lblDateTime;
	}

	public void setLblDateTime(JLabel lblDateTime) {
		this.lblDateTime = lblDateTime;
	}

	public JLabel getLblGz1() {
		return lblGz1;
	}

	public void setLblGz1(JLabel lblGz1) {
		this.lblGz1 = lblGz1;
	}

	public JLabel getLblGz2() {
		return lblGz2;
	}

	public void setLblGz2(JLabel lblGz2) {
		this.lblGz2 = lblGz2;
	}

	public JLabel getLblTxt1() {
		return lblTxt1;
	}

	public void setLblTxt1(JLabel lblTxt1) {
		this.lblTxt1 = lblTxt1;
	}

	public JLabel getLblAmount() {
		return lblAmount;
	}

	public void setLblAmount(JLabel lblAmount) {
		this.lblAmount = lblAmount;
	}

	public JButton getBtnBack() {
		return btnBack;
	}

	public void setBtnBack(JButton btnBack) {
		this.btnBack = btnBack;
	}

	public JLabel getLblUnderline() {
		return lblUnderline;
	}

	public void setLblUnderline(JLabel lblUnderline) {
		this.lblUnderline = lblUnderline;
	}

	public JLabel getLblTxt2() {
		return lblTxt2;
	}

	public void setLblTxt2(JLabel lblTxt2) {
		this.lblTxt2 = lblTxt2;
	}

	public JLabel getLabelOfficialLogo() {
		return labelOfficialLogo;
	}

	public void setLabelOfficialLogo(JLabel labelOfficialLogo) {
		this.labelOfficialLogo = labelOfficialLogo;
	}

	public JLabel getLabelMinilogo() {
		return labelMinilogo;
	}

	public void setLabelMinilogo(JLabel labelMinilogo) {
		this.labelMinilogo = labelMinilogo;
	}

	public JLabel getLblCopyright() {
		return lblCopyright;
	}

	public void setLblCopyright(JLabel lblCopyright) {
		this.lblCopyright = lblCopyright;
	}

	public JLabel getLblTimeDateRep() {
		return lblTimeDateRep;
	}

	public void setLabel(JLabel lblTimeDateRep) {
		this.lblTimeDateRep = lblTimeDateRep;
	}

	public JButton getBack() {
		return btnBack;
	}

	public JLabel getAmount() {
		return lblAmount;
	}

	public void addActionListener(ActionListener chikorita) {
		btnBack.addActionListener(chikorita);
	}
}
